<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title>md5加密</title>
    <script src="//cdn.66173.cn/www/js/jquery-1.8.3.min.js"></script>
    <script type="text/ecmascript" src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.min.js"></script>
    <script type="text/javascript">
        $(window).ready(function () {
            var hash = md5("123456");
            alert(hash)
        })
    </script>
</head>
<body>
<form action="" method="post" class="form-inline" id="from-test" onsubmit="return checkInput()">
    <input type="text" id="username" name="username"> 姓名 <br>
    <input type="password" id="password"> 密码 <br>
    <input type="hidden" id="password_md5" name="password">
    <button type="submit" onclick="checkInput()">Submit</button>
</form>
</body>
<script>
    function checkInput() {
        var password_input = document.getElementById('password');
        var password_md5 = document.getElementById('password_md5');

        // set password
        password_md5.value =  md5(password_input.value);
        alert(password_md5.value)
        return true;
    }
</script>
</html>